package endpoint

import (
	"context"
	"net/http"
	"time"

	"goKit/global"
	"goKit/service"

	"github.com/go-kit/kit/endpoint"
	"github.com/gorilla/mux"
)

func GenVcEndpoint() endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (response interface{}, err error) {
		r := request.(*http.Request)
		vars := mux.Vars(r)
		if uid, ok := vars["uid"]; ok {
			user := service.User{}
			time.Sleep(time.Second * 2)
			return global.ResponseParam(10101, user.GetUserName(uid)), nil
		}
		return global.ResponseParam(10102, "出错了"), nil
	}
}
